package com.ctrip.cap.domain.benchmark;

import java.util.Date;

import com.ctrip.cap.domain.benchmark.util.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

 

public abstract class GeneralInfo {
	
	public GeneralInfo()
	{
		status=true;
	}
	public void setTimeSpan(long timeSpan) {
		this.timeSpan = timeSpan;
	}
	@JsonInclude(Include.NON_NULL)
	public Object getOthers() {
		return others;
	}
	public void setOthers(Object others) {
		this.others = others;
	}
	@JsonInclude(Include.NON_NULL)
	public long getTimeSpan() {
		return timeSpan;
	}
	@JsonInclude(Include.NON_NULL)
	@JsonSerialize(using = JsonDateSerializer.class)
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	@JsonInclude(Include.NON_NULL)
	@JsonSerialize(using = JsonDateSerializer.class)
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	@JsonInclude(Include.NON_NULL)
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	@JsonInclude(Include.NON_NULL)
	public boolean getStatus() {
		return status;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}
	
	public void generateTimeSpan()
	{
		if(startTime!=null&&endTime!=null)
		{
			timeSpan=endTime.getTime()-startTime.getTime();
		}
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	
	private Date startTime;
	private Date endTime;
	private String message;
	private boolean status; 
	private long timeSpan;
	private Date time=new Date();
	private Object others;

}
